<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.util.*"%>
<%
request.setCharacterEncoding("utf-8");//设置页面字符集
DBO db=new DBO();//数据库链接
String   yhm="",mm="",xm="",rxsj="",cssj="",xb="",bj="";//初始化变量
String keyid=(String)request.getParameter("keyid");//主键
String sql="select * from xuesheng where xsid="+keyid;//定义查询sql语句
ResultSet rs=null;//定义查询结果集
db.open();//打开数据库链接
rs=db.query(sql);//执行查询结果

/*
学生信息修改页面
*/
if(rs.next()){//遍历结果集查询 相应的变量
 yhm=rs.getString("yhm");
mm=rs.getString("mm");
xm=rs.getString("xm");
rxsj=rs.getString("rxsj");
cssj=rs.getString("cssj");
xb=rs.getString("xb");
bj=rs.getString("bj");

}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="../images/style.css" type=text/css rel=stylesheet>
<link rel="stylesheet" type="text/css" media="screen" href="../css/tinyTips.css" />
<script language="javascript" src="../js/date.js"></script>
<script language="javascript">
function checkDo(){
if(form.yhm.value==""){
alert("用户名不能为空");
return false;
form.yhm.focus();
}

if(form.mm.value==""){
alert("密码不能为空");
return false;
form.mm.focus();
}

if(form.xm.value==""){
alert("姓名不能为空");
return false;
form.xm.focus();
}

if(form.rxsj.value==""){
alert("入学时间不能为空");
return false;
form.rxsj.focus();
}

if(form.cssj.value==""){
alert("出生时间不能为空");
return false;
form.cssj.focus();
}

if(form.xb.value==""){
alert("性别不能为空");
return false;
form.xb.focus();
}

if(form.bj.value==""){
alert("班级不能为空");
return false;
form.bj.focus();
}


form.action="xuesheng_update.jsp";
form.submit();
}
</script>

</head>
<body>

<form name="form" action="" method="post" >
<div class=formzone>
<DIV class=searchzone>

<TABLE height=30 cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD height=30>学生修改</TD>
    <TD align=right colSpan=2>&nbsp;</TD>
  </TR></TBODY></TABLE></DIV>
<div class=tablezone>
<div class=noticediv id=notice></div>
<TABLE cellSpacing=0 cellPadding=2 width="100%" align=center border=0>
  <TBODY>

		<tr >
<td align=middle width=100 height=30>用户名</td><td height="30" ><input type="text"  class="input" style="FONT-SIZE: 12px; WIDTH: 300px" name=yhm value="<%=yhm%>" readonly=""></td>
</tr>
<tr >
<td align=middle width=100 height=30>密码</td><td height="30" ><input type="text"  class="input" style="FONT-SIZE: 12px; WIDTH: 300px" name=mm value="<%=mm%>"></td>
</tr>
<tr >
<td align=middle width=100 height=30>姓名</td><td height="30" ><input type="text"  class="input" style="FONT-SIZE: 12px; WIDTH: 300px" name=xm value="<%=xm%>"></td>
</tr>
<tr >
<td align=middle width=100 height=30>入学时间</td><td height="30" ><input type="text"  class="input" style="FONT-SIZE: 12px; WIDTH: 300px" name=rxsj value="<%=rxsj%>" onclick="new Calendar().show(this);"></td>
</tr>
<tr >
<td align=middle width=100 height=30>出生时间</td><td height="30" ><input type="text"  class="input" style="FONT-SIZE: 12px; WIDTH: 300px" name=cssj value="<%=cssj%>" onclick="new Calendar().show(this);"></td>
</tr>
<tr >
<td align=middle width=100 height=30>性别</td><td height="30" >

<select name="xb">
<option value="男" <%if(xb.equals("男")) out.println("selected");%>>男</option>
<option value="女"  <%if(xb.equals("女")) out.println("selected");%>>女</option>
</select>
</td>
</tr>
<tr >
<td align=middle width=100 height=30>班级</td><td height="30" >

<select name="bj">
<option value="">请选择</option>
<%
 sql="select * from banji ";
 rs=db.query(sql);
while(rs.next()){
%>

<option value="<%=rs.getString("bj")%>" <%if(rs.getString("bj").equals(bj)) out.println("selected");%>><%=rs.getString("bj")%></option>

<% }%>
</select>
</td>
</tr>

</TBODY></TABLE>
</div>  <input type="hidden" name="keyid" value="<%=keyid%>">
<DIV class=adminsubmit> <input type="button" value="保存" name="B1" class="button" style="width:60px" onclick="checkDo()"  />
                      &nbsp;&nbsp;
                      <input type="reset" value="取消" style="width:60px" name="chanel" class="button" />
</div>
</div>
</form>
</body>
<%
db.close();
%>
</html>
